🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / map / src / androidMain / kotlin / org / meshtastic / feature / map / component / DeleteWaypointDialog.kt
Displaying Raw • Download
feature/map/src/androidMain/kotlin/org/meshtastic/feature/map/component/DeleteWaypointDialog.kt bbef7670a13ecb0bbdd88f6a0ca886fc4bdb0e9a (bbef7670) Text, 3.90 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.map.component
Tff7b72import T7ee787androidx.compose.foundation.layout.Row
Tff7b72import T7ee787androidx.compose.foundation.layout.Spacer
Tff7b72import T7ee787androidx.compose.foundation.layout.fillMaxWidth
Tff7b72import T7ee787androidx.compose.foundation.layout.width
Tff7b72import T7ee787androidx.compose.foundation.selection.toggleable
Tff7b72import T7ee787androidx.compose.material3.Checkbox
Tff7b72import T7ee787androidx.compose.material3.Text
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.runtime.getValue
Tff7b72import T7ee787androidx.compose.runtime.mutableStateOf
Tff7b72import T7ee787androidx.compose.runtime.remember
Tff7b72import T7ee787androidx.compose.runtime.setValue
Tff7b72import T7ee787androidx.compose.ui.Alignment
Tff7b72import T7ee787androidx.compose.ui.Modifier
Tff7b72import T7ee787androidx.compose.ui.semantics.Role
Tff7b72import T7ee787androidx.compose.ui.unit.dp
Tff7b72import T7ee787org.jetbrains.compose.resources.stringResource
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.cancel
Tff7b72import T7ee787org.meshtastic.core.resources.delete
Tff7b72import T7ee787org.meshtastic.core.resources.delete_for_everyone
Tff7b72import T7ee787org.meshtastic.core.resources.waypoint_delete
Tff7b72import T7ee787org.meshtastic.core.ui.component.MeshtasticDialog
T8b949e/**
* Waypoint removal confirmation, shared by both map flavors. Confirming always drops our local copy — that needs no
* mesh-wide permission, so it stays available for a waypoint locked to another node. Broadcasting the removal to the
* mesh is the opt-in checkbox, offered only when [canDeleteForEveryone] (unlocked or locked to us, and connected).
*/
Tf0883e@Composable
Tff7b72fun Td2a8ffDeleteWaypointDialogTb4b4b4(
Te6edf3canDeleteForEveryoneTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onDeleteForMeTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3onDeleteForEveryoneTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3onDismissRequestTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3modifierTb4b4b4: Te6edf3Modifier Tff7b72= Te6edf3ModifierTb4b4b4,
Tb4b4b4) Tb4b4b4{
T8b949e// Keyed on eligibility so a mid-dialog disconnect clears the opt-in along with the checkbox that set it, rather
T8b949e// than leaving a stale selection that would broadcast on confirm.
Tff7b72var Te6edf3alsoDeleteForEveryone Tff7b72by Te6edf3rememberTb4b4b4(Te6edf3canDeleteForEveryoneTb4b4b4) Tb4b4b4{ Te6edf3mutableStateOfTb4b4b4(Tff7b72falseTb4b4b4) Tb4b4b4}
Te6edf3MeshtasticDialogTb4b4b4(
Te6edf3modifier Tff7b72= Te6edf3modifierTb4b4b4,
Te6edf3titleRes Tff7b72= Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3waypoint_deleteTb4b4b4,
Te6edf3text Tff7b72=
Tff7b72if Tb4b4b4(Te6edf3canDeleteForEveryoneTb4b4b4) Tb4b4b4{
Tb4b4b4{
T8b949e// The whole row is one toggleable target so the label names the checkbox to a screen reader.
Te6edf3RowTb4b4b4(
Te6edf3modifier Tff7b72=
Te6edf3ModifierTb4b4b4.Te6edf3fillMaxWidthTb4b4b4(Tb4b4b4)
Tb4b4b4.Te6edf3toggleableTb4b4b4(
Te6edf3value Tff7b72= Te6edf3alsoDeleteForEveryoneTb4b4b4,
Te6edf3role Tff7b72= Te6edf3RoleTb4b4b4.Te6edf3CheckboxTb4b4b4,
Te6edf3onValueChange Tff7b72= Tb4b4b4{ Te6edf3alsoDeleteForEveryone Tff7b72= Tffa657it Tb4b4b4}Tb4b4b4,
Tb4b4b4)Tb4b4b4,
Te6edf3verticalAlignment Tff7b72= Te6edf3AlignmentTb4b4b4.Te6edf3CenterVerticallyTb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3CheckboxTb4b4b4(Te6edf3checked Tff7b72= Te6edf3alsoDeleteForEveryoneTb4b4b4, Te6edf3onCheckedChange Tff7b72= Tff7b72nullTb4b4b4)
Te6edf3SpacerTb4b4b4(Te6edf3modifier Tff7b72= Te6edf3ModifierTb4b4b4.Te6edf3widthTb4b4b4(T79c0ff8.Te6edf3dpTb4b4b4)Tb4b4b4)
Te6edf3TextTb4b4b4(Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3delete_for_everyoneTb4b4b4)Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4} Tff7b72else Tb4b4b4{
Tff7b72null
Tb4b4b4}Tb4b4b4,
Te6edf3confirmTextRes Tff7b72= Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3deleteTb4b4b4,
Te6edf3onConfirm Tff7b72= Tb4b4b4{ Tff7b72if Tb4b4b4(Te6edf3canDeleteForEveryone Tff7b72&Tff7b72& Te6edf3alsoDeleteForEveryoneTb4b4b4) Te6edf3onDeleteForEveryoneTb4b4b4(Tb4b4b4) Tff7b72else Te6edf3onDeleteForMeTb4b4b4(Tb4b4b4) Tb4b4b4}Tb4b4b4,
Te6edf3dismissTextRes Tff7b72= Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3cancelTb4b4b4,
Te6edf3onDismiss Tff7b72= Te6edf3onDismissRequestTb4b4b4,
Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.06s